﻿Imports CommonUtils
Imports System.Data.SqlClient

Public Class FlashCards
    Inherits genFlashCards

    Public Sub New()
        MyBase.New()
    End Sub

    Public Sub New(ByVal id As Integer)
        MyBase.New(id)
    End Sub

    Public Function GetCard(ByVal sDealersUpCard As String, ByVal sPlayersHand As String) As FlashCards
        Dim dt As DataTable = ListByDealersUpCardAndPlayersHand(sDealersUpCard, sPlayersHand)
        Dim oRet As New FlashCards()
        If dt.Rows.Count > 0 Then
            oRet.Construct(CInt(dt.Rows(0)("FlashCardID")))
        Else
            oRet.SuggestedActionID = 4      'Stay
            oRet.ExplanationID = 2009       'No Entry in DB.
        End If
        Return oRet
    End Function

    Public Function IsToughHand(ByVal sDealersUpCard As String, ByVal sPlayersHand As String) As Boolean
        Dim dt As DataTable = Me.ListByDealersUpCardAndPlayersHand(sDealersUpCard, sPlayersHand)
        If dt.Rows.Count > 0 Then
            If dt.Rows(0)("ToughHand") Then
                Return True
            Else
                Return False
            End If
        End If
        Return False
    End Function

End Class
